package com.tony.jdbctemplate.service.impl;

import com.tony.jdbctemplate.dao.StudentDao;
import com.tony.jdbctemplate.entity.Student;
import com.tony.jdbctemplate.service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * create by xuxia on 2024/2/6 09:04
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentDao studentDao;

    @Override
    public int addStudent(Student student) {
        return studentDao.add(student);
    }

    @Override
    public int updateStudent(Student student) {
        return studentDao.update(student);
    }

    @Override
    public int deleteStudent(String sno) {
        return studentDao.deleteBySno(sno);
    }

    @Override
    public List<Map<String, Object>> queryAllStudentsOfMap() {
        return studentDao.queryStudentsListMap();
    }

    @Override
    public List<Student> queryAllStudentsOfBean() {
        return studentDao.queryAllStudents();
    }

    @Override
    public Student queryStudent(String sno) {
        return studentDao.queryStudentBySnoWithMap(sno);
    }
}
